<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<%
System.out.println("====error====\n"+exception);
String urlParam = "";
urlParam = "?"+request.getQueryString();
 
String[] emailList = { "chejug@gmail.com" };// 메일 보낼사람 리스트 
String emailFromAddress = "chejug@gmail.com";// 메일 보내는 사람
String emailMsgTxt = ""; // 내용
emailMsgTxt+="접속자 아이피 : " + request.getRemoteAddr()+"\n";
emailMsgTxt+="에러정보 : " + exception.toString()+"\n";
emailMsgTxt+="url : " + urlParam+"\n";
emailMsgTxt+="이전페이지  : " + request.getHeader("REFERER")+"\n";

emailMsgTxt+="헤더정보  : " + "\n";
java.util.Enumeration enum1 = request.getHeaderNames();

boolean botchk =true;
while(enum1.hasMoreElements()){ 
  String name = (String)enum1.nextElement(); // 헤더의 name값을 얻어오기
  String value = request.getHeader(name);   // 얻어온 헤더의 name값으로 value값 얻어오기
  emailMsgTxt+=name+  ":" + value +"\n" ;
  if( value.toLowerCase().indexOf("googlebot") > -1			//구글봇
		  ||	value.toLowerCase().indexOf("bingbot") > -1	//빙봇
		  ){
	  botchk=false;
  }
} 
//다닐목 펜션 제거
if(urlParam.indexOf("danilmok")>-1){
	botchk=false;
}
if(botchk){
	
	String emailSubjectTxt = "[ error 접수 ] pension ";// 제목
	emailMsgTxt = new String(emailMsgTxt.getBytes("euc-kr"), "8859_1");
	kr.co.pension.utils.MailUtil  nMail = new kr.co.pension.utils.MailUtil();
	// 메일보내기
	try{
		nMail.postMail(emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);	
	}catch(Exception e){
		out.println("====error====");
	}
}
// out.println("<br><br>"+emailMsgTxt+"<br><br>");


%>
<%@ page isErrorPage="true" %>
<html>
<head>
<title>에러발생</title>
<meta name="decorator" content="pub_main"/>


</head>

<body>
에러가 발생했습니다. 조속히 처리하도록 하겠습니다<br/>
</body>
</html>
